﻿using System;
using System.Collections.Generic;
using System.Data;
using System.Data.SqlClient;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace WindowsFormsApplication5
{
   public  class DBHepler
    {
       private static string conString = "server=.;database=Schools;uid=sa;pwd=12345678;";

       public static DataTable GetDataTable(string sql)
        { 
        SqlConnection conn =new SqlConnection (conString );

        SqlDataAdapter adapter = new SqlDataAdapter(sql, conn);

        conn.Open();

        DataTable dt = new DataTable();

        adapter.Fill(dt);

        return dt;

       }
       public static int AddDrUpdateOrDelete(string sql) 
        {
          SqlConnection conn = new SqlConnection(conString);

          SqlCommand com = new SqlCommand(sql, conn);

          conn.Open();

          return com.ExecuteNonQuery();
       }
    }
}
